import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import AppLayout from '@/components/layout/AppLayout.vue'
// import HomeView from '@/views/Home.vue'
import SystemHomeView from '@/views/SystemHome.vue'

import LoginView from '@/views/auth/Login.vue'
import RegisterView from '@/views/auth/Register.vue'

import SettingsView from '@/views/system/Settings.vue'
import AIProjectView  from '@/views/system/AIProject.vue'
import AIchatView  from '@/views/system/AIchat.vue'
import BlogView from '@/views/system/Blog.vue'

import AccountsView from '@/views/family/Accounts.vue'
import PetManageView from '@/views/family/PetManage.vue'  
import RecipeView  from '@/views/family/Recipe.vue'
import CopyWritingView from '@/views/system/CopyWriting.vue'

import ProfileView from '@/views/Profile.vue'

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/login',
  },
  {
    path: '/profile',
    name: 'Profile',
    component: () => ProfileView
  },
  {
    path: '/login',
    name: 'Login',
    component: LoginView
  },
  {
    path: '/register',
    name: 'Register',
    component: RegisterView
  },
  {
    path: '/system',
    component: AppLayout,
    children: [
      {
        path: '',
        component: () => SystemHomeView // 按需加载更佳
      },
      {
        path: 'settings',
        name: 'Settings',
        component: SettingsView
      },
      {
        path: 'aichat',
        name: 'AIChat',
        component: AIchatView
      },
      {
        path: 'ai-project',
        name: 'AIProject',
        component: AIProjectView
      },
      {
        path: 'blog',
        name: 'Blog',
        component: BlogView
      },
      {
        path: 'copywriting',
        name: 'CopyWritingView',
        component: CopyWritingView
      }
    ]
  },
  {
    path: '/family',
    component: AppLayout,
    children: [
      {
        path: '',
        component: () => SystemHomeView // 按需加载更佳
      },
      {
        path: 'accounts',
        name: 'Accounts',
        component: AccountsView
      },
      {
        path: 'pet-manage',
        name: 'PetManage',
        component: PetManageView
      },
      {
        path: 'recipe',
        name: 'Recipe',
        component: RecipeView
      }
    ]
  },
  {
    path: '/article/:id',
    name: 'ArticleDetail',
    component: () => import('@/views/ArticleDataView.vue'),
    props: true
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router